package com.zzq.mapper;

import com.zzq.pojo.Admin;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface AdminMapper {

    @Select("select * from admin where username=#{username}")
    Admin findByAdminName(String username);

    @Update("update admin set password=#{newPwd} where username=#{username}")
    void updatePassword(String username, String newPwd);

    @Select("select count(*) from tender_info where state='招标'")
    int getOngoingProjects();

    @Select("select count(*) from tender_info where state='待审核'")
    int getPendingReviews();

    @Select("select sum(bid_amount) from bid_info where status='中标'")
    Double getMonthlyRevenue();

    @Select("select count(*) from bidder where status='1'")
    int getBids();

    @Select("select count(*) from tenderer where status='1'")
    int getTender();

    @Select("select count(*) from tender_info where state='中标'")
    int getSuccess();
}
